package k5;

import java.io.IOException;
import java.util.ArrayList;

import k5.Knapsack;
import k5.Item;

public class main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		int index, totalWeight;;
		String fileName="100";
		String strLine;
		Item item;
		Knapsack knapsack = new Knapsack();
		ArrayList<String> lines = Utils.readFile(fileName);
		ArrayList<Item> items = new ArrayList<Item>();
		ArrayList<Item> best = new ArrayList<Item>();
		totalWeight = Integer.parseInt(lines.get(0));
		for(int i=1;i<lines.size();i++){
			strLine = lines.get(i);
			index = strLine.indexOf(' ');
			item = new Item(Integer.parseInt(strLine.substring(0, index)), Integer.parseInt(strLine.substring(index+1)));
			items.add(item);
		}
		best = knapsack.depth_first_branch_and_bound(items, totalWeight);
	}

}
